﻿using System;
using System.Linq.Expressions;
using Dsl.Ped.Framework.Helpers;
using Dsl.Ped.Framework.Members;

namespace Dsl.Ped.Framework.Extensions
{
    /// <summary>
    /// Extension methods for the <see cref="Expression"/>
    /// </summary>
    public static class ExpressionExtension
    {
        /// <summary>
        /// Get the member of the <see cref="Expression"/>
        /// </summary>
        /// <typeparam name="T">Type of the expression function</typeparam>
        /// <param name="expr">Expression whic member we are interested in</param>
        /// <returns>Member out of the <see cref="expr"/></returns>
        public static Member GetMember<T>(this Expression<Func<T>> expr)
        {
            return ExpressionHelper.GetMember(expr);
        }
    }
}
